package com.atguigu.day21.file01;

import org.junit.Test;

import java.io.File;
import java.io.FilenameFilter;
/*
获取
判断
创建
文件夹中的内容 list


 */
public class FileTest2 {

    @Test
    public void test03(){
        File file =new File("D:/software");
      /*  File[] files = file.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
               // boolean b = name.endsWith("exe");

                return  name.endsWith("exe");
            }
        });*/
        File[] files = file.listFiles((d,n)->n.endsWith("exe"));

        for (File f : files) {
            System.out.println("f = " + f);
        }
    }


    @Test
    public void test02(){
     File f =new File("D:/software");
        File[] files = f.listFiles();
        for (File file : files) {
            System.out.println("file = " + file+" , "+file.isFile());

        }
    }

    @Test
    public void test01(){

        File f = new File("D:\\software");

        String[] list = f.list();

        for (String s : list) {
            System.out.println("s = " + s+" , "+s.toUpperCase());
        }

    }
}
